<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2025/7/31 星期四
  Time: 16:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>




<!DOCTYPE html>
<html>

<head>
    <base href="${pageContext.request.contextPath}/" />
    <title>襄阳蓝芯智能化办公系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="static/bootstrap-3.3.5/css/bootstrap.css" rel="stylesheet">
    <style>
        /*定义类名为.thead-blue的样式*/
        .thead-blue {
            color: #fff;
            font-weight: bold;
            background-color: #337ab7;
        }
    </style>
    <script src="static/jquery/jquery-1.10.2.min.js"></script>
    <script src="static/bootstrap-3.3.5/js/bootstrap.js"></script>
</head>
<body>
<!-- 搜索 -->
<div class="panel panel-primary">
    <div class="panel-heading">
        <h4 class="panel-title">员工调动搜索</h4>
    </div>
    <div class="panel-body">
        <form action="hr/zz-adjustment/adjustmentInfo" id="seachform" method="post" class="form-horizontal" role="form">

            <div class="form-group">
                <div class="col-md-4">
                    <label for="startDate" class="col-md-4 control-label">开始时间</label>
                    <div class="col-md-8">
                        <input type="hidden" name="page" id="page" value="1">
                        <input type="hidden" name="pageSize" id="pageSize" value="5">
                        <input type="hidden" name="empid" value="5">
                        <input type="date" id="startDate" name="startDate" class="form-control" value="${startDate}">
                    </div>
                </div>
                <div class="col-md-4">
                    <label for="endDate" class="col-md-4 control-label">结束时间</label>
                    <div class="col-md-8">
                        <input type="date" id="endDate" name="endDate" class="form-control" value="${endDate}">
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="col-md-12">
                        <button type="submit" class="btn btn-success">搜索调动记录</button>
                        <button type="button" onclick="location.href='hr/emp/listEmpVo'" class="btn btn-info">返回</button>
                    </div>
                </div>
            </div>


        </form>
    </div>
</div>

<!-- 列表 -->
<div class="panel panel-primary">
    <table class="table table-bordered table-hover">
        <thead>
        <tr class="thead-blue" align="center">
            <td>员工姓名</td>
            <td>调动前部门</td>
            <td>调动前职位</td>
            <td>调动后部门</td>
            <td>调动后职位</td>
            <td>调动时间</td>
            <td>调动原因</td>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${adjustmentVosAlone.records}" var="adjustmentVo">
            <tr align="center">
                <td>${adjustmentVo.empName}</td>
                <td>${adjustmentVo.originDeptName}</td>
                <td>${adjustmentVo.originJobName}</td>
                <td>${adjustmentVo.destDeptName}</td>
                <td>${adjustmentVo.destJobName}</td>
                <td>
                    ${adjustmentVo.adjustDate}
                </td>
                <td>${adjustmentVo.reason}</td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>

<!-- 分页 -->
<div class="input-group col-md-6 col-md-offset-3">
    <div class="row">
        <div class="btn-group">
            <button onclick="gotoPage(1,${adjustmentVosAlone.size})" class="btn btn-primary" type="button">首页</button>

            <c:choose>
                <c:when test="${adjustmentVosAlone.current>1}">
                    <button class="btn btn-primary" onclick="gotoPage(${adjustmentVosAlone.current-1},${adjustmentVosAlone.size})" type="button">上一页</button>
                </c:when>
                <c:otherwise>
                    <button class="btn btn-primary disabled" type="button">上一页</button>
                </c:otherwise>
            </c:choose>

            <button class="btn btn-primary disabled" type="button">当前第${adjustmentVosAlone.current}/${adjustmentVosAlone.pages}页</button>

            <div class="btn-group">
                <button type="button" class="btn btn-primary dropdown-toggle"
                        data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    每页显示${adjustmentVosAlone.size}条 <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li><a href="javascript:gotoPage(1,5)">每页显示5条</a></li>
                    <li><a href="javascript:gotoPage(1,10)">每页显示10条</a></li>
                    <li><a href="javascript:gotoPage(1,15)">每页显示15条</a></li>
                    <li><a href="javascript:gotoPage(1,20)">每页显示20条</a></li>
                </ul>
            </div>

            <button class="btn btn-primary disabled" type="button">共${adjustmentVosAlone.total}条记录</button>


            <c:choose>
                <c:when test="${adjustmentVosAlone.current<adjustmentVosAlone.pages}">
                    <button class="btn btn-primary" onclick="gotoPage(${adjustmentVosAlone.current+1},${adjustmentVosAlone.size})" type="button">下一页</button>
                </c:when>
                <c:otherwise>
                    <button class="btn btn-primary disabled" type="button">下一页</button>
                </c:otherwise>
            </c:choose>



            <button onclick="gotoPage(${adjustmentVosAlone.pages},${adjustmentVosAlone.size})" class="btn btn-primary" type="button">尾页</button>
        </div>
    </div>
</div>

<br><br><br>
<script type="text/javascript">
    $(document).ajaxError(function(event,xhr) {
        if(xhr.status=="403"){//没有权限
            document.location.href = xhr.getResponseHeader("url");
        }else if(xhr.status!="200"){
            //alert("服务器错误!");
            console.log("服务器错误!");
        }
    });
</script>

<script type="text/javascript">
    function setempvalue(eid, empName) {
        $("#empid").val(eid);
        $("#empName").val(empName);
    }
</script>
</body>
<script type="text/javascript">
    function gotoPage(page,pageSize){
        $("#page").val(page);
        $("#pageSize").val(pageSize);
        $("#seachform").submit();
    }
    function searchBtn(){
        $("#page").val(1);
        $("#seachform").submit();
    }
    function clearSearch(){
        $("#startDate").val("");
        $("#endDate").val("");
        $("#empid").val("");
        $("#empName").val("");

    }

</script>
</html>
